//一一注册 类型判断函数
let isType= function(type){
    return function(obj){
        return Object.prototype.toString.call(obj)=== `[object ${type}]`
    }
}

let isString=isType('String')
let isArray=isType('Array')
let isFunction=isType('Function')
let object=isType('Object')


// 批量注册

let Type={}

let type=['String','Number','Array']

for(let i=0;i<type.length;i++){
    Type['is'+type[i]]=function(obj){
        return Object.prototype.toString.call(obj)===`[object ${type[i]}]`
    }
}
console.log(Type,Type.isArray([]));
